import React from 'react';
import pic from '../../components/Home/imgs/banner.webp';
import '../../components/Home/Banner.scss';
import { home_swiper } from '../../utils/api.js'
import { Swiper } from 'antd-mobile'
class Banner extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            bannerList: [],
        }
    }
    render() {
        return (
            <div className='Banner'>
                <Swiper autoplay>{
                    this.state.bannerList.map((item, index) => (
                        <Swiper.Item key={index}>
                            <img src={item.pic} alt="" />
                        </Swiper.Item>
                    ))
                }
                </Swiper>
            </div >
        );
    }
    componentDidMount() {
        home_swiper().then((res) => {
            this.setState({
                bannerList: res.data.list,
            })
        })
    }
}

export default Banner;